package com.ruoyi.system.mapper;

import java.util.List;
import com.ruoyi.system.domain.Website;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 网址导航Mapper接口
 * 
 * @author 何文财
 * @date 2021-09-14
 */
public interface WebsiteMapper 
{
    /**
     * 查询网址导航
     * 
     * @param id 网址导航ID
     * @return 网址导航
     */
    public Website selectWebsiteById(Long id);

    /**
     * 查询网址导航列表
     * 
     * @param website 网址导航
     * @return 网址导航集合
     */
    public List<Website> selectWebsiteList(Website website);

    /**
     * 新增网址导航
     * 
     * @param website 网址导航
     * @return 结果
     */
    public int insertWebsite(Website website);

    /**
     * 修改网址导航
     * 
     * @param website 网址导航
     * @return 结果
     */
    public int updateWebsite(Website website);

    /**
     * 删除网址导航
     * 
     * @param id 网址导航ID
     * @return 结果
     */
    public int deleteWebsiteById(Long id);

    /**
     * 批量删除网址导航
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    public int deleteWebsiteByIds(Long[] ids);


    @Select("SELECT\n" +
            "\tw.*\n" +
            "FROM\n" +
            "\twebsite w\n" +
            "LEFT JOIN website_type t ON w.id = t.website_id\n" +
            "WHERE\n" +
            "\tt.type = #{dictLabel} ")
    List<Website> listGroupType(String dictLabel);


    @Insert("insert into website_type(website_id, type) values (#{website_id},#{type})")
    int insertWebsiteType(@Param("website_id") Long websiteId,@Param("type") String type);
}
